package com.neusoft.elmboot.mapper;


import java.math.BigDecimal;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neusoft.elmboot.po.VirtualWallet;
import com.neusoft.elmboot.po.VirtualWalletTrans;

@Mapper
public interface VirtualWalletMapper {

    @Select("select * from wallet where walletId=#{walletId}")
    public VirtualWallet getVirtualWallet (Long walletId);

    @Select("select balance from wallet where walletId=#{walletId}")
    public BigDecimal getBalance(Long walletId);

    @Update("update wallet set balance=#{balance} where walletId=#{walletId}")
    public int updateBalance(Long walletId, BigDecimal balance);

    @Insert("insert into wallet (walletId,balance,createTime,userId,overdraftAmount) values(#{walletId},#{balance},#{createTime},#{userId},#{overdraftAmount})")
    public int createVirtualWallet(VirtualWallet newWallet);

    @Select("select * from wallet where userId=#{userId}")
    public VirtualWallet getVirtualWalletByUserId(String userId);

    //更新透支金额
    @Update("update wallet set overdraftAmount=#{overdraftAmount} where walletId=#{walletId}")
    public int updateOverdraftAmount(Long walletId, BigDecimal overdraftAmount);

    

}
